package com.qdu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qdu.commons.Result;
import com.qdu.entity.Problem;
import com.qdu.mapper.ProblemMapper;
import com.qdu.service.IProblemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ellery2018
 * @since 2022-03-09
 */
@Service
public class ProblemServiceImpl extends ServiceImpl<ProblemMapper, Problem> implements IProblemService {

    QueryWrapper<Problem> queryWrapper = new QueryWrapper<>();

    @Override
    public List<Problem> findAllProblem() {

        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public int insertProblem(Problem problem) {
        return baseMapper.insert(problem);
    }

    @Override
    public int deleteProblem(int id) {
        return baseMapper.deleteById(id);
    }

    @Override
    public int updateProblem(Problem problem) {
        return baseMapper.updateById(problem);
    }
}
